﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ChsExceptions.GameEdit;
using DAL;

namespace BLL
{
    public class ChsXmlGameEditBLL : ChsGameEditBLL
    {
        public override void OpenDAO(params object[] parameters)
        {
            if(parameters.Count() > 1)
                throw new ChsWrongArgumentsException();
            if (parameters.Count() == 0)
            {
                dao = new ChsXmlGameEditDAO("default.cse");
                return;
            }
            if(!(parameters[0] is string))
                throw new ChsWrongArgumentsException();
            dao = new ChsXmlGameEditDAO((string)parameters[0]);
        }

        public override void CloseDAO(params object[] parameters)
        {
            dao = null;
            GC.Collect();
        }
    }
}
